$(function () {
  
    // 请求数据
    $.ajax({
        url:`http://39.101.217.150:8075/banner/list`,
        type:'post',
        success:function (data) {
            var records = data.data;
            $.each(records,function (index,item) {
                $('.swiper-wrapper').append(`
                
                <div class="swiper-slide"><img src="${item.url}" src='./img/loading.jpg' alt=""></div>
                `)
            })

            var mySwiper = new Swiper ('.swiper', {
                loop: true, // 循环模式选项
                
                // 如果需要分页器
                pagination: {
                  el: '.swiper-pagination',
                },
            
              })   
          }
    })
    
    // 马上学习的数据获取
    $.ajax({
        url:`http://39.101.217.150:8075/apps/list`,
        data:{
            page:1,
            size:4
        },
        success:function (data) {
            var records = data.data.records;
            $.each(records,function (index,item) {
                $('#fast-study ul').append(`
                <li>
                <img src="${item.imgurl}" alt="">
                <span>${item.appName}</span>
                </li>
                `)


              })

          }
    })
    // 预约学习的数据获取
    $.ajax({
        url:`http://39.101.217.150:8075/course/list`,
        data:{
            page:1,
            size:4
        },
        success:function (data) {
            var records = data.data.records;
            $.each(records,function (index,item) {
                $('#appointment-study ul').append(`
                <li>
                <img src="${item.imgUrl}" alt="">
                <span>${item.name}</span>
                </li>
                `)


              })

          }
    })
    // 点击更多跳转
    $('.s-more').click(function () {
        var title = $(this).attr('data-title')
        window.location.href = './search.html#'+title+'';

      })

  })